package com.example.readbook.UI.BaseUI;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.example.readbook.R;
import com.example.readbook.Utils.UIUtils;
import com.example.readbook.View.MyProgressLoading;


/**
 * Package    : com.example.baseutils.BaseUI
 * When I wrote this, only The jade emperor and I understood what I was doing, Now God only knows
 * ClassName  : BaseActivity
 * Description: ${TODO}
 * Author     : 坐怀灬不乱
 * Date       : 2018/12/22 14:59
 */
public abstract class BaseActivity extends AppCompatActivity {
    protected Activity          mActivity;
    protected MyProgressLoading loading;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutResID());
        mActivity = this;
        loading = new MyProgressLoading(mActivity, R.style.DialogStyle);
        UIUtils.setStatusBar(this, 3, R.color.blue_2595e4);
        setTitleBarColor();
        FirstLoad();
        initView();
        initData();
        initListener();
    }

    //使子模块功能 能优先于 initView initData initListener加载
    protected void FirstLoad() {
    }

    protected void setTitleBarColor() {
    }

    /**
     * 布局view
     */
    public abstract int getLayoutResID();

    /**
     * 初始化控件
     */
    public abstract void initView();

    /**
     * 初始化监听
     */
    public abstract void initListener();

    /**
     * 初始化数据
     */
    public abstract void initData();

}
